package cn.lyvust.demo.shili07;

/**
 * Description:
 * date: 2021-5-10 21:44
 *
 * @author Guo_guo
 * @since JDK 1.8
 */
public class Student implements Comparable{
    private int number=0; 			//学号
    private String name=""; 		//学生姓名
    private String gender="";	 	//性别
    public int getNumber(){
        return number;
    }
    public void setNumber(int number){
        this.number=number;
    }
    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name=name;
    }
    public String getGender(){
        return gender;
    }
    public void setGender(String gender){
        this.gender=gender;
    }
    public int compareTo(Object obj){
        Student student=(Student)obj;
        if(this.number==student.number){
            return 0;			//如果学号相同，那么两者就是相等的
        }else if(this.number>student.getNumber()){
            return 1;			//如果这个学生的学号大于传入学生的学号
        }else{
            return -1;			//如果这个学生的学号小于传入学生的学号
        }
    }
}
